package com.hfh.main.group.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Accessors(chain = true)
@TableName("col_group_detail")
@Schema(name = "GroupDetailEntity", description = "$!{table.comment}")
@Builder
public class GroupDetailEntity extends Model<GroupDetailEntity> {

    @Schema(description = "编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @NotNull(message="编号不能为空")
    @Schema(description = "分组编号")
    @TableField("group_id")
    private Integer groupId;

    @NotEmpty(message="学号不能为空")
    @Schema(description = "学生学号")
    @TableField("user_acc")
    private String acc;

    @Schema(description = "创建者")
    @TableField("create_by")
    private String createBy;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    @TableField("create_time")
    private Date createTime;

    @Schema(description = "更新者")
    @TableField("update_by")
    private String updateBy;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间")
    @TableField("update_time")
    private Date updateTime;

    @Schema(description = "伪删除")
    @TableField("undock")
    private Integer undock;

    @Schema(description = "状态")
    @TableField("state")
    private Integer state;

    @Schema(description = "备注")
    @TableField("remark")
    private String remark;

    //字段补充
    @Schema(description = "名称")
    @TableField(exist = false)
    private String name;

    @Schema(description = "身份")
    @TableField("identity")
    private String identity;

    @Schema(description = "联系电话")
    @TableField(exist = false)
    private String phone;

    @Schema(description = "最终得分")
    @TableField(exist = false)
    private String dbFinal;//这里仅做展示 设为String

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
